//package com.bootdo.screen.service;
//
//import com.alibaba.fastjson.JSON;
//import com.alibaba.fastjson.JSONObject;
//import com.bootdo.screen.config.ESConfig;
//import com.bootdo.screen.domain.EnergyData;
//import org.apache.http.HttpStatus;
//import org.apache.http.util.EntityUtils;
//import org.elasticsearch.client.Response;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//
//import java.io.IOException;
//
//@Service
//public class EnergyDataService {
//    @Autowired
//    private ESConfig esConfig;
//
//    private final String SIZE0 ="/energy_search/doc/_search";
//
//    public EnergyData getEnergyData(){
//        EnergyData energyData = new EnergyData();
//        String resp ="";
//        resp = esConfig.execQuery("{ \"query\": {\"term\": { \"cate_name\": { \"value\": \"open\" } }} , \"size\": 0 }", SIZE0);
//        energyData.setInternetNum(JSON.parseObject(resp).getJSONObject("hits").getLong("total"));
//        resp = esConfig.execQuery("{ \"query\": {\"term\": { \"cate_name\": { \"value\": \"trade\" } }} , \"size\": 0 }", SIZE0);
//        energyData.setTradeNum(JSON.parseObject(resp).getJSONObject("hits").getLong("total"));
//        return  energyData;
//    }
//}
//
